package com.itheima.demo3;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        //定义服务端套接字
        ServerSocket ss = new ServerSocket(10086);
        //读取客户端的字符流数据

        //监听接收客户端
        Socket accept = ss.accept();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(accept.getInputStream()));
        BufferedWriter br = new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));

        String s;
        while ((s = bufferedReader.readLine()) != null) {
                //打印
               StringBuilder sb =new StringBuilder(s);
            String s1 = sb.reverse().toString();
            System.out.println("服务器返回:");
            System.out.println(s1);

        }

       

        ss.close();

    }
}
